/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: ComCfg.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: Com
*
* Generation Time: 2025-02-04 15:31:15
*
*******************************************************************************/

#ifndef COMCFG_H
#define COMCFG_H

/** HEADER FILES **/
#include "ComType.h"
#include "ComRte.h" 


/** MACRO DEFINITION **/
#define ComConf_ComRxPduCfg_Pdu_Channel1_Other_Other_Can3   PduRComConf_PduHandleId_Rx_Channel1_Other_Other_Can3
#define ComConf_ComRxPduCfg_Pdu_Channel1_Other_Other_Can2   PduRComConf_PduHandleId_Rx_Channel1_Other_Other_Can2
#define ComConf_ComRxPduCfg_Pdu_Channel1_Other_Other_Can1   PduRComConf_PduHandleId_Rx_Channel1_Other_Other_Can1
#define ComConf_ComRxPduCfg_Pdu_Max   3u

#define ComConf_ComTxPduCfg_Pdu_Channel1_Qsar_Qsar_Can4   PduRComConf_PduHandleId_Tx_Channel1_Qsar_Qsar_Can4
#define ComConf_ComTxPduCfg_Pdu_Channel1_Qsar_Qsar_Can3   PduRComConf_PduHandleId_Tx_Channel1_Qsar_Qsar_Can3
#define ComConf_ComTxPduCfg_Pdu_Channel1_Qsar_Qsar_Can2   PduRComConf_PduHandleId_Tx_Channel1_Qsar_Qsar_Can2
#define ComConf_ComTxPduCfg_Pdu_Channel1_Qsar_Qsar_Can1   PduRComConf_PduHandleId_Tx_Channel1_Qsar_Qsar_Can1
#define ComConf_ComTxPduCfg_Pdu_Max   4u

#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can4_First  0u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can4_Max  0u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_First  0u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_Qsar_Can3_Yaya   0u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_Qsar_Can3_RollingCounter   1u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_Qsar_Can3_Haha   2u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_Qsar_Can3_Checksum   3u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can3_Max  4u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_First  4u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Qsar_Can2_RollingCounter   4u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Qsar_Can2_Checksum   5u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Qsar_Can2_SignalC   6u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Qsar_Can2_SignalB   7u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Qsar_Can2_SignalA   8u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can2_Max  5u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_First  9u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_Qsar_Can1_SignalD_Intel   9u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_Qsar_Can1_SignalC_Motorola   10u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_Qsar_Can1_SignalB_Intel   11u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_Qsar_Can1_SignalA_Motorola   12u
#define ComConf_Tx_SignalId_Channel1_Qsar_Qsar_Can1_Max  4u
#define ComConf_Tx_SignalId_Max   13u

#define ComConf_Rx_SignalId_Channel1_Other_Other_Can3_First  0u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can3_Max  0u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_First  0u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_Other_Can2_Checksum   0u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_Ohter_Can2_RollingCounter   1u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_Other_Can2_SignalB   2u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_Other_Can2_SignalA   3u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can2_Max  4u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_First  4u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_Other_Can1_SignalD_Intel   4u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_Other_Can1_SignalC_Motorala   5u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_Other_Can1_SignalB_Intel   6u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_Other_Can1_SignalA_Motorala   7u
#define ComConf_Rx_SignalId_Channel1_Other_Other_Can1_Max  4u
#define ComConf_Rx_SignalId_Max   8u

#define COM_SIGNAL_TYPE_BOOLEAN (0u) /* ComSignalType: BOOLEAN */
#define COM_SIGNAL_TYPE_UINT8 (1u) /* ComSignalType: UINT8 */
#define COM_SIGNAL_TYPE_UINT16 (2u) /* ComSignalType: UINT16 */
#define COM_SIGNAL_TYPE_UINT32 (3u) /* ComSignalType: UINT32 */
#define COM_SIGNAL_TYPE_UINT64 (4u) /* ComSignalType: UINT64 */
#define COM_SIGNAL_TYPE_SINT8 (5u) /* ComSignalType: SINT8 */
#define COM_SIGNAL_TYPE_SINT16 (6u) /* ComSignalType: SINT16 */
#define COM_SIGNAL_TYPE_SINT32 (7u) /* ComSignalType: SINT32 */
#define COM_SIGNAL_TYPE_FLOAT32 (8u) /* ComSignalType: FLOAT32 */
#define COM_SIGNAL_TYPE_FLOAT64 (9u) /* ComSignalType: FLOAT64 */
#define COM_SIGNAL_TYPE_UINT8_N (10u) /* ComSignalType: UINT8_N */
#define COM_SIGNAL_TYPE_UINT8_DYN (11u) /* ComSignalType: UINT8_DYN */

#define COM_SIGNAL_LITTLE_ENDIAN (0u) /* ComSignalEndianness: LITTLE_ENDIAN */
#define COM_SIGNAL_BIG_ENDIAN (1u) /* ComSignalEndianness: BIG_ENDIAN */

#define COM_IPDU_DIRECTION_SEND (0u) /* ComIPduDirection: SEND */
#define COM_IPDU_DIRECTION_RECEIVE (1u) /* ComIPduDirection: RECEIVE */

#define COM_IPDU_TYPE_NORMAL (0u) /* ComIPduType: NORMAL */
#define COM_IPDU_TYPE_TP (1u) /* ComIPduType: TP */

#define COM_IPDU_TX_CLEAR_UPDATE_BIT_CONFIRMATION (0u) /* ComTxIPduClearUpdateBit : Confirmation */
#define COM_IPDU_TX_CLEAR_UPDATE_BIT_TRANSMIT (1u) /* ComTxIPduClearUpdateBit : Transmit */
#define COM_IPDU_TX_CLEAR_UPDATE_BIT_TRIGGERTRANSMIT (2u) /* ComTxIPduClearUpdateBit : TriggerTransmit */

#define COM_TX_MODE_NONE (0u) /* ComTxModeMode: NONE */
#define COM_TX_MODE_DIRECT (1u) /* ComTxModeMode: DIRECT */
#define COM_TX_MODE_PERIODIC (2u) /* ComTxModeMode: PERIODIC */
#define COM_TX_MODE_MIXED (3u) /* ComTxModeMode: MIXED */


/** TYPEDEF DEFINITION **/
typedef void (*Com_CbkAckFuncType)(
    void
);

typedef void (*Com_CbkTOutFuncType)(
    void
);

typedef uint8 Com_ConfigType;

typedef struct
{
    Com_CbkAckFuncType ComNotification;
    Com_CbkTOutFuncType ComTimeoutNotification;
    uint8 bitPosition; /* ComBitPosition */
    uint8 bitSize;/* ComBitSize */
    uint8 signalLength;/* ComSignalLengt */
    uint32 signalInitValue; /* ComSignalInitValue */
    uint8 comHandleId;/* ComHandleId */
    uint8 signalType; /* ComSignalType */
    uint8 signalEndianness; /* ComSignalEndianness */
    uint8* signalBufferPtr;  /* Start Byte position   in the signal buffer */
}Com_SignalConfigType;

typedef struct
{
    uint16 timePeriod  ; /* ComTxModeTimePeriod */
    uint8 timeOffset; /* ComTxModeTimeOffset */
    uint8 mode; /* ComTxModeMode */
}Com_TxModeType;

typedef struct
{
    uint8 unusedAreasDefault; /* ComTxIPduUnusedAreasDefault  */
    uint8 minimumDelayTime; /* ComMinimumDelayTime */
    uint8 txIPduClearUpdateBit; /* ComTxIPduClearUpdateBit */
    Com_TxModeType txMode; /* Com_TxMode */
}Com_TxIPduConfigType;

typedef Std_ReturnType(*ComIPduCalloutType)(
    PduIdType TxPduId,
    PduInfoType* PduInfoPtr
);

typedef struct
{
    /* This parameter defines the existence and the name of a callout function for 
       the corresponding I-PDU. If this parameter is omitted no I-PDU callout 
       shall take place for the corresponding I-PDU */
    ComIPduCalloutType ComIPduCallout;
    Com_SignalConfigType* signalPtr; /* ComIPduSignalRef */
    uint8 signalNumber;
    PduIdType pduId;/* ComIPduHandleId */
    uint8* pduPtr; /* ComPduIdRef */
    uint8 comIPduType; /* ComIPduType  */
    Com_TxIPduConfigType comTxIPdu; /* comTxIPdu  */
}ComIPduType;


/** LOCAL DATA DEFINITION **/
extern const Com_SignalConfigType Com_TxSignal[ComConf_Tx_SignalId_Max];
extern const Com_SignalConfigType Com_RxSignal[ComConf_Rx_SignalId_Max];

extern const ComIPduType Com_TxPduConfig[ComConf_ComTxPduCfg_Pdu_Max];
extern const ComIPduType Com_RxPduConfig[ComConf_ComRxPduCfg_Pdu_Max];


#endif
